home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
tos_updt
/
fmcity
/
palcom
/
auto
/
script
/
bbssel.mx
< prev
next >
Wrap
Text File
|
1995-04-11
|
20KB
|
676 lines
//--------------------------------------------------------------------------//
// PALCOM V2.1 L10 //
// 自動通信:巡回掲示板の選択 //
// //
// CopyRight(C) 1994/10/20 //
// FUJITSU PERSONAL COMPUTER SYSTEMS LIMITED //
// written by C-cube Soft T.Nakamura //
//--------------------------------------------------------------------------//
event @OPEN.EXTERN {
//--- データの取得 ---//
$dataList = Auto.makeBbsList( AUTO.getBbsData(), [1,4], 0 );
if( $dataList == #FALSE ) {
AUTO.setDialogReturn( 0 );
return;
}
$titleList = list.getNth( $dataList, 1 );
$statusList = list.getNth( $dataList, 2 );
$idList = list.getNth( $dataList, 3 );
$dayList = list.getNth( $dataList, 4 );
$keyList = list.getNth( $dataList, 5 );
//--- 掲示板情報が無い場合は、掲示板巡回を一度実行するように ---//
//--- ユーザに促す ---//
if( list.size( $titleList ) == 0 ) {
$saveXsize = dialog.getDefaultXSize();
dialog.setDefaultXSize( 352 );
sys.pushCursor( 80 );
dialog.ask(["━━━━━━━ 巡回する掲示板の設定 ━━━━━━━",
"",
" 掲示板の情報が取得されていません。 ",
" 「自動通信の設定2」の「掲示板を読む」を有効にし、 ",
" 一度この自動通信の手順を実行してください。 ",
""],["確認"] );
sys.popCursor();
dialog.setDefaultXSize( $saveXsize );
AUTO.setDialogReturn( 0 );
return;
}
//--- ボタンの設定 ---//
$setBtnId = dialog.makeButton( 1, "設定", 0, 0x8012 );
$canBtnId = dialog.makeButton( 1, "取消", 0, 0x8011 );
$loopBtnId = dialog.makeButton( 1, "巡回", 0, 0 );
$extBtnId = dialog.makeButton( 1, "条件設定", 0, 0 );
sys.global( $setBtnId );
sys.global( $canBtnId );
sys.global( $loopBtnId );
sys.global( $extBtnId );
//--- ダイアログ制御 ---//
$ret = Auto.bbsSel( $titleList, $statusList, $idList, $dayList, $keyList );
//--- ボタンの開放 ---//
dialog.delButton( $setBtnId );
dialog.delButton( $canBtnId );
dialog.delButton( $loopBtnId );
dialog.delButton( $extBtnId );
sys.local( $setBtnId );
sys.local( $canBtnId );
sys.local( $loopBtnId );
sys.local( $extBtnId );
if( $ret >= 0 ) { // 「設定」の場合
$dataList = Auto.remakeBbsList( $titleList, $statusList,
$idList, $dayList, $keyList );
AUTO.setBbsData( $dataList );
AUTO.setDialogReturn( 1 );
return;
}
AUTO.setDialogReturn( 0 );
return;
}
event @CLOSE.EXTERN {
return;
}
event @ERROR {
local.errorFunc();
event.mainLoop();
}
//--------------------------//
//--- ダイアログ制御 ---//
//--------------------------//
function Auto.bbsSel( $titleList,$statusList,$idList,$dayList,$keyList ) {
//--- データの加工 ---//
$i = 1;
$ttMaxLen = 0;
$defList = [1];
$lsList = [];
$ttList = [];
$stList = [];
$iiList = [];
$dyList = [];
$kyList = [];
foreach( $a, $titleList ) {
if( data.getType( $a ) == #LIST ) { // サブメニューがある
$st = list.get1st( list.getNth( $statusList, $i ));
$tt = str.join(["<", list.get1st( $a ), ">"], "" );
$id = "";
$day = "";
$key = "";
} else {
$st = list.getNth( $statusList, $i );
$id = list.getNth( $idList, $i );
$day = list.getNth( $dayList, $i );
$key = list.getNth( $keyList, $i );
$tt = $a;
}
list.putLast( $ttList, $tt );
list.putLast( $stList, $st );
list.putLast( $iiList, $id );
list.putLast( $dyList, $day );
list.putLast( $kyList, $key );
if( str.length( $tt ) > $ttMaxLen ) {
$ttMaxLen = str.length( $tt );
}
$i = $i + 1;
}
$i = 1;
foreach( $a, $stList ) {
list.putLast( $lsList, Auto.makeListStr( $a,
list.getNth( $ttList, $i ),
list.getNth( $dyList, $i ),
list.getNth( $iiList, $i ),
list.getNth( $kyList, $i ),
$ttMaxLen ));
$i = $i + 1;
}
//--- ダイアログデータの設定 ---//
$dialogList = ["掲示板の設定", 0, -1, -1, $setBtnId,
["", 1028, [80,10,0], $lsList, $defList],
["", $canBtnId, [0], [""], [""]],
["", $setBtnId, [0], [""], [""]],
["", $extBtnId, [0], [""], [""]],
["", $loopBtnId, [0], [""], [""]]];
//--- ダイアログの表示 ---//
$updateFlg = 0;
loop {
sys.pushCursor( 80 );
dialog.open( $dialogList );
sys.popCursor();
//--- 復帰データの設定 ---//
$btnId = list.get1st( $$DIALOG.RETURN );
$no = list.get1st( list.getNth( $$DIALOG.RETURN, 2 ));
//--- 選択されていないと実行出来ない物のチェック ---//
if(( $no == -1 )&&(( $btnId == $extBtnId )||( $btnId == $loopBtnId ))){
continue;
}
list.del1st( $defList );
list.put1st( $defList, $no );
if( $btnId == $loopBtnId ) { // 「巡回」ボタン
if( data.getType( list.getNth( $titleList, $no )) == #LIST ) {
//--- サブメニューの選択 ---//
$ret =Auto.bbsSel( list.getNth(list.getNth($titleList, $no),2),
list.getNth(list.getNth($statusList,$no),2),
list.getNth($idList, $no),
list.getNth($dayList, $no),
list.getNth($keyList, $no));
if( $ret == 0 ) {
list.delNth( $stList, $no );
list.putNth( $stList, $no - 1, #FALSE );
} elif( $ret == 1 ) {
list.delNth( $stList, $no );
list.putNth( $stList, $no - 1, #TRUE );
} else {
continue;
}
} else {
if( list.getNth( $stList, $no ) == #TRUE ) {
list.delNth( $stList, $no );
list.putNth( $stList, $no - 1, #FALSE );
} else {
list.delNth( $stList, $no );
list.putNth( $stList, $no - 1, #TRUE );
}
}
} elif( $btnId == $extBtnId ) { // 「条件設定」ボタン
if( data.getType( list.getNth( $titleList, $no )) == #LIST ) {
continue;
}
if( Auto.setExt( $iiList, $dyList, $kyList, $no ) == 0 ) {
continue;
}
} else {
exit;
}
list.delNth( $lsList, $no );
list.putNth( $lsList, $no - 1,
Auto.makeListStr( list.getNth( $stList, $no ),
list.getNth( $ttList, $no ),
list.getNth( $dyList, $no ),
list.getNth( $iiList, $no ),
list.getNth( $kyList, $no ),
$ttMaxLen ));
$updateFlg = 1;
continue;
}
//--- 復帰データの設定 ---//
if( $btnId == $setBtnId ) {
$ret = 0;
if( $updateFlg == 1 ) {
$i = 1;
foreach( $a, $titleList ) {
if( list.getNth( $stList, $i ) == #TRUE ) {
$ret = 1;
}
if( data.getType( $a ) == #LIST ) {
$wk = list.getNth( $statusList, $i );
list.del1st( $wk );
list.put1st( $wk, list.getNth( $stList, $i ));
$i = $i + 1;
continue;
}
list.delNth( $statusList, $i );
list.putNth( $statusList, $i - 1, list.getNth( $stList, $i ));
list.delNth( $idList, $i );
list.putNth( $idList, $i - 1, list.getNth( $iiList, $i ));
list.delNth( $dayList, $i );
list.putNth( $dayList, $i - 1, list.getNth( $dyList, $i ));
list.delNth( $keyList, $i );
list.putNth( $keyList, $i - 1, list.getNth( $kyList, $i ));
$i = $i + 1;
}
}
return( $ret );
}
//--- 「取消」ボタンの場合 ---//
return( -1 );
}
//----------------------------------------//
//--- 掲示板の一覧リストを作成する ---//
//----------------------------------------//
function Auto.makeBbsList( $dataList, $tag, $mode ) {
$trdId = AUTO.getTrdId();
$titleList = [];
$statusList = [];
$idList = [];
$dayList = [];
$keyList = [];
if( $mode == 0 ) {
$tagSub = list.putLast( data.copy( $tag ), -2 );
$retList = trd.getData( $trdId, $tagSub );
if( list.get1st( $retList ) == 0 ) {
return([[],[],[],[],[]]);
}
dialog.openProg(["掲示板情報を読み込んでいます",""], "", #TRUE );
}
//--- 経過表示用にデータの個数を調べる ---//
$errFlg = #FALSE;
if( $mode != 2 ) {
$num = 0;
$tagSub = list.putLast( data.copy( $tag ), -5 );
list.putLast( $tagSub, -2 );
loop {
$ret = trd.checkList( $trdId, $tagSub );
if( list.get1st( $ret ) == 0 ) {
exit;
}
$tagSub = list.putLast( data.copy( $tag ),
list.getNth( list.getNth( $ret, 2 ),
list.size( $tag ) + 1 ));
trd.checkListPush( $trdId );
$numSub = Auto.makeBbsList( [], $tagSub, 1 );
if( $numSub == #FALSE ) {
if( $mode == 0 ) {
sys.local( $num );
sys.local( $cnt );
dialog.close();
}
return( #FALSE );
}
if( $numSub == 0 ) {
dialog.close();
sys.pushCursor( 80 );
$saveXsize = dialog.getDefaultXSize();
dialog.setDefaultXSize( 352 );
$ret = dialog.ask([
"━━━━━━━ 巡回する掲示板の設定 ━━━━━━━",
"",
" 掲示板の情報に異常が発見されました。 ",
"",
" 「継続」して設定を行う場合、一部の掲示板の設定が ",
" 行えない場合があります。 ",
""],["中断", "継続"] );
sys.popCursor();
dialog.setDefaultXSize( $saveXsize );
list.putLast( $tagSub, -2 );
trd.delData( $trdId, $tagSub );
trd.setData( $trdId, [1,5], "1" );
AUTO.setTrdUpdateFlg();
if( $ret == 0 ) {
return( #FALSE );
}
dialog.openProg(["掲示板情報を読み込んでいます",""],"",#TRUE );
}
$num = $num + $numSub + 1;
trd.checkListPop( $trdId );
$tagSub = [];
}
$tagSub = list.putLast( data.copy( $tag ), -6 );
$num = $num + trd.count( $trdId, $tagSub );
if( $mode == 1 ) {
return( $num );
}
}
if( $mode == 0 ) {
if( $num == 0 ) {
trd.delData( $trdId, [1,4,-2] );
AUTO.setTrdUpdateFlg();
dialog.updateProg( 100 );
dialog.close();
return([[],[],[],[],[]]);
}
sys.global( $num );
sys.global( $cnt );
$cnt = 0;
}
//--- 便宜上グループデータから検索 ---//
$tagSub = list.putLast( data.copy( $tag ), -5 );
list.putLast( $tagSub, -2 );
loop {
$ret = trd.getData( $trdId, $tagSub );
if( list.get1st( $ret ) == 0 ) {
exit;
}
$str = list.getNth( $ret, 2 );
$tagSub = list.putLast( data.copy( $tag ),
list.getNth( list.getNth( $ret, 3 ),
list.size( $tag ) + 1 ));
//--- 一致するデータを探し、サブメニューを設定 ---//
$list = [];
$st = #FALSE;
foreach( $a, $dataList ) {
if( data.getType( $a ) == #LIST ) {
if( list.get1st( $a ) == $str ) {
$st = list.getNth( $a, 2 );
$list = list.getNth( $a, 3 );
exit;
}
}
}
trd.getDataPush( $trdId );
$ret = Auto.makeBbsList( $list, data.copy( $tagSub ), 2 );
if( $ret == #FALSE ) {
if( $mode == 0 ) {
sys.local( $num );
sys.local( $cnt );
dialog.close();
}
return( #FALSE );
}
trd.getDataPop( $trdId );
list.putLast( $titleList, [$str,list.getNth( $ret, 1 )] );
list.putLast( $statusList, [$st, list.getNth( $ret, 2 )] );
list.putLast( $idList, list.getNth( $ret, 3 ));
list.putLast( $dayList, list.getNth( $ret, 4 ));
list.putLast( $keyList, list.getNth( $ret, 5 ));
$tagSub = [];
$cnt = $cnt + 1;
dialog.updateProg( $cnt * 100 / $num );
}
//--- データの設定 ---//
$tagSub = list.putLast( data.copy( $tag ), -6 );
loop {
$ret = trd.getData( $trdId, $tagSub );
if( list.get1st( $ret ) == 0 ) {
exit;
}
$str = list.getNth( $ret, 2 );
$st = #FALSE;
$id = "";
$day = "000000";
$key = "";
foreach( $a, $dataList ) {
if( data.getType( list.getNth( $a, 3 )) == #LIST ) {
continue;
}
if( list.get1st( $a ) == $str ) {
$st = list.getNth( $a, 2 );
$id = list.getNth( $a, 3 );
$day = list.getNth( $a, 4 );
$key = list.getNth( $a, 5 );
exit;
}
}
list.putLast( $titleList, $str );
list.putLast( $statusList, $st );
list.putLast( $idList, $id );
list.putLast( $dayList, $day );
list.putLast( $keyList, $key );
$tagSub = [];
$cnt = $cnt + 1;
dialog.updateProg( $cnt * 100 / $num );
}
if( $mode == 0 ) {
sys.local( $num );
sys.local( $cnt );
dialog.close();
}
return([$titleList, $statusList, $idList, $dayList, $keyList]);
}
//------------------------------------//
//--- 掲示板情報を組み立て直す ---//
//------------------------------------//
function Auto.remakeBbsList(
$titleList,
$statusList,
$idList,
$dayList,
$keyList )
{
$retList = [];
$i = 1;
foreach( $a, $titleList ) {
$st = list.getNth( $statusList, $i );
if( data.getType( $a ) == #LIST ) {
$list = Auto.remakeBbsList( list.getNth( $a, 2 ),
list.getNth( $st, 2 ),
list.getNth( $idList, $i ),
list.getNth( $dayList, $i ),
list.getNth( $keyList, $i ));
$list = [list.get1st( $a ), list.get1st( $st ), $list];
} else {
$list = [$a, $st,
list.getNth( $idList, $i ),
list.getNth( $dayList, $i ),
list.getNth( $keyList, $i )];
}
list.putLast( $retList, $list );
$i = $i + 1;
}
return( $retList );
}
//--------------------------------------------//
//--- リストに表示する文字列の組み立て ---//
//--------------------------------------------//
function Auto.makeListStr( $st, $tt, $day, $id, $key, $ttMaxLen ) {
if( $st == #TRUE ) {
$mark = "■";
} else {
$mark = "□";
}
$spcSub = " ";
$ttSub = str.join([$tt,str.left($spcSub,$ttMaxLen-str.length( $tt ))],"");
if( $id == "" ) {
$id = " ";
}
if( $day == "" ) {
$day = " ";
} elif( $day == "000000" ) {
$day = "--/--/--";
} else {
$day = str.join( [str.mid( $day, 0, 2 ),
str.mid( $day, 2, 2 ),
str.mid( $day, 4, 2 )], "/", );
}
return( str.join( [$mark, $ttSub, $day, $id, $key], " " ));
}
//----------------------------------//
//--- 条件指定ダイアログ制御 ---//
//----------------------------------//
function Auto.setExt( $idList, $dayList, $keyList, $no ) {
//--- ボタンの設定 ---//
$idBtn = dialog.makeButton( 1, " ID名簿 ", 0, 0 );
$tdayBtnId = dialog.makeButton( 1, " 今 日 ", 0, 0 );
//--- 初期値設定 ---//
$iiList = [list.getNth( $idList, $no )];
if( list.getNth( $dayList, $no ) == "000000" ) {
$dyList = [""];
} else {
$dyList = [list.getNth( $dayList, $no )];
}
$kyList = [list.getNth( $keyList, $no )];
//--- ダイアログリストの設定 ---//
$dialogList = ["巡回掲示板の条件設定", 0, -1, -1, $setBtnId,
["", 1024, [0], [""], [""]],
["基準日付け: 例) 1993年1月30日→930130 ",
1025, [6,0], [""], $dyList],
["", $tdayBtnId, [0], [""], [""]],
["検索ID : 英字3+数字5 例) AAA00000 ",
1025, [8,0], [""], $iiList],
["", $idBtn, [0], [""], [""]],
["検索キー :",
1025, [40,0], [""], $kyList],
["", 1024, [0], [""], [""]],
["", $canBtnId, [0], [""], [""]],
["", $setBtnId, [0], [""], [""]]
];
DIALOG.OPEN:
//--- ダイアログの表示 ---//
sys.pushCursor( 80 );
dialog.open( $dialogList );
sys.popCursor();
$btnId = list.getNth( $$DIALOG.RETURN, 1 );
//--- 設定状態の退避 ---//
$str = list.get1st( list.getNth( $$DIALOG.RETURN, 3 ));
list.del1st( $dyList );
list.put1st( $dyList, $str );
$str = list.get1st( list.getNth( $$DIALOG.RETURN, 4 ));
list.del1st( $iiList );
list.put1st( $iiList, $str );
$str = list.get1st( list.getNth( $$DIALOG.RETURN, 5 ));
list.del1st( $kyList );
list.put1st( $kyList, $str );
//--- 各種ボタン処理 ---//
if( $btnId == $tdayBtnId ) { // 「今日」ボタン
$day = time.getDate();
$day = str.join([str.right( data.toString( list.get1st( $day )), 2 ),
data.toString2( list.getNth( $day, 2 ), 2, "0", 0 ),
data.toString2( list.getNth( $day, 3 ), 2, "0", 0 )],
"" );
list.del1st( $dyList );
list.put1st( $dyList, $day );
goto DIALOG.OPEN;
} elif( $btnId == $idBtn ) { // 「ID名簿」ボタン
//--- ID名簿の起動 ---//
$ret = mod.idBase( 1, #FALSE );
if( $ret == #FALSE ) {
//--- どこかで使用中である ---//
$saveXsize = dialog.getDefaultXSize();
dialog.setDefaultXSize( 312 );
sys.pushCursor( 80 );
dialog.ask(["━━━━━━━━━ ID名簿 ━━━━━━━━━",
"",
" ID名簿がすでに他プロセスで使用されています。",
" 起動中のID名簿を終了させて下さい。 ",
""],["確認"] );
sys.popCursor();
dialog.setDefaultXSize( $saveXsize );
goto DIALOG.OPEN;
}
if( list.size( $ret ) != 0 ) {
//--- 復帰データをリストに設定する ---//
list.del1st( $iiList );
list.put1st( $iiList, list.get1st( $ret ));
}
goto DIALOG.OPEN;
} elif( $btnId == $setBtnId ) { // 「設定」ボタン
//--- 日付けの正当性チェック ---//
$str = list.get1st( $dyList );
list.del1st( $dyList );
if( list.getNth( $dayList, $no ) == "000000" ) {
list.put1st( $dyList, "" );
} else {
list.put1st( $dyList, list.getNth( $dayList, $no ));
}
if( $str != "" ) {
if( str.length( $str ) < 6 ) {
$errMsg = " 日付に誤りがあります。 ";
goto DATE.ERROR;
}
$year = data.toNumber( str.mid( $str, 0, 2 )) + 1900;
if(( $year < 1990 )||( $year > 1999 )) {
$errMsg = "1990年から1999年の範囲で指定を行ってください。";
goto DATE.ERROR;
}
if(( $year % 4 == 0 )&&( $year % 100 != 0 )||( $year % 400 == 0 )){
$daysList = [31,29,31,30,31,30,31,31,30,31,30,31];
} else {
$daysList = [31,28,31,30,31,30,31,31,30,31,30,31];
}
$mon = data.toNumber( str.mid( $str, 2, 2 ));
if(( $mon < 1 )||( $mon > 12 )) {
$errMsg = " 月の指定に誤りがあります。 ";
goto DATE.ERROR;
}
$day = data.toNumber( str.mid( $str, 4, 2 ));
if(( $day < 1 )||( $day > list.getNth( $daysList, $mon ))) {
$errMsg = " 日の指定に誤りがあります。 ";
goto DATE.ERROR;
}
}
list.del1st( $dyList );
list.put1st( $dyList, $str );
//--- 検索IDの正当性チェック ---//
$str = list.get1st( $iiList );
list.del1st( $iiList );
list.put1st( $iiList, list.getNth( $idList, $no ));
if( $str != "" ) {
if( str.length( $str ) != 8 ) {
$errMsg = " 検索IDに誤りがあります。 ";
goto DATE.ERROR;
}
$i = 1;
foreach( $a, str.split( $str, "" )) {
if( $i < 4 ) {
if((($a < "A")||($a > "Z"))&&(($a < "a")||($a > "z"))) {
$errMsg =
" 検索IDに誤りがあります。 ";
goto DATE.ERROR;
}
} else {
if(( $a < "0" )||( $a > "9" )) {
$errMsg =
" 検索IDに誤りがあります。 ";
goto DATE.ERROR;
}
}
$i = $i + 1;
}
$str = str.smallToLarge( $str );
}
list.del1st( $iiList );
list.put1st( $iiList, $str );
//--- 結果の反映 ---//
list.delNth( $idList, $no );
list.putNth( $idList, $no - 1, list.get1st( $iiList ));
list.delNth( $dayList, $no );
if( list.get1st( $dyList ) == "" ) {
list.putNth( $dayList, $no - 1, "000000" );
} else {
list.putNth( $dayList, $no - 1, list.get1st( $dyList ));
}
list.delNth( $keyList, $no );
list.putNth( $keyList, $no - 1, list.get1st( $kyList ));
} else { // 「取消」ボタン
dialog.delButton( $idBtn );
dialog.delButton( $tdayBtnId );
return( 0 );
}
dialog.delButton( $idBtn );
dialog.delButton( $tdayBtnId );
return( 1 );
DATE.ERROR:
$saveXsize = dialog.getDefaultXSize();
dialog.setDefaultXSize( 288 );
sys.pushCursor( 80 );
dialog.ask(["━━━━━━━ 巡回条件の設定 ━━━━━━━",
"",
$errMsg,
""],["確認"]);
sys.popCursor();
dialog.setDefaultXSize( $saveXsize );
goto DIALOG.OPEN;
}